A compiler transforms a source code written in one language, such as C or C++ or Fortran, into a compiled code, expressed in another language, such as assembly code, machine code, or a higher-level code, that is executable by specific hardware. Compilers typically transform the source code in stages such as an analysis stage and a synthesis stage. The analysis stage may generate an intermediate representation of the source code to make the resulting code easier to synthesize. The synthesis stage may perform tasks such as code optimization to increase the speed and/or efficiency of the compiled code and code generation to generate the compiled code.
There are various high-level and low-level strategies for optimizing target code. High-level optimizations may involve machine-independent, programming operations. Low-level optimizations may involve machine-dependent transformations such as optimizations involving task offloading. However, existing solutions are not efficient. For example, some existing solutions are not efficient in cases when the data processing code runs on a separate device(s) with its own smaller memory where processed arrays do not fit entirely.